package simplyrugby.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import simplyrugby.entity.AgeGroup;
import simplyrugby.mapper.AgeGroupMapper;
import simplyrugby.service.AgeGroupService;

/**
* @author admin
* @description 针对表【age_group(年龄组)】的数据库操作Service实现
* @createDate 2025-03-29 18:37:24
*/
@Service
public class AgeGroupServiceImpl extends ServiceImpl<AgeGroupMapper, AgeGroup>
    implements AgeGroupService{

    @Override
    public Page<AgeGroup> list(Integer pageNum, Integer pageSize, AgeGroup ageGroup) {
        LambdaQueryWrapper<AgeGroup> wrapper = Wrappers.lambdaQuery(AgeGroup.class)
                .eq(!ObjectUtils.isEmpty(ageGroup.getId()), AgeGroup::getId, ageGroup.getId())
                .like(!ObjectUtils.isEmpty(ageGroup.getName()), AgeGroup::getName, ageGroup.getName());

        Page<AgeGroup> page = new Page<>(pageNum, pageSize);
        this.page(page, wrapper);
        return page;
    }
}




